<template>
  <div>
    <h1 v-text="msg" ref="title"></h1>
    <button @click="showDom" ref="btn">点我输出上方的DOM元素</button>
    <School ref="sch " id="sch"/>
  </div>
</template>
<script>
import School from "./components/School.vue";
export default {
  // name配置项决定调试工具显示的标签名
  name: "App",
  components: {
    School,
  },
  data() {
    return {
      msg: "学习脚手架",
    };
  },
  methods: {
    showDom() {
      // 获取h1DOM元素
      console.log(this.$refs.title);
      //  获取buttonDOM元素
      console.log(this.$refs.btn);
      //  获取shcool组件的实例对象vc
      console.log(this.$refs.sch);

      //  采用原生方式获取school DOM元素(返回的本质上是school组件内template里的内容)
      // console.log(document.querySelector('#sch'));
    },
  },
};
</script>

<style>
</style>